package com.smedi.ismedi.inmail.core.port.adapter.persistence.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.smedi.ismedi.database.starter.model.BasicFieldEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.data.annotation.Transient;

import java.io.Serializable;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @className: DingAttenDanceResult
 * @Description: TODO
 * @version: v1.0.0
 * @author: wzx
 * @date: 2022/9/20 17:00
 */

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName(value = "iml_ding_attendance_result")
public class DingAttendanceResultEntity extends BasicFieldEntity implements Serializable {

    /**
     *
     * 考勤类型：

     * OnDuty：上班

     * OffDuty：下班
     * */
    @TableField(value = "check_type")
    private String checkType;

    /**
     * 位置结果：

     * Normal：范围内

     * Outside：范围外

     * NotSigned：未打卡
     * */
    @TableField(value = "location_result")
    private String locationResult;

    /**
     * 计算迟到和早退，基准时间
     * */
    @TableField(value = "base_check_time")
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime baseCheckTime;

    /** 考勤组ID */
    @TableField(value = "group_id")
    private Long groupId;

    /**
     * 打卡结果：

     * Normal：正常

     * Early：早退

     * Late：迟到

     * SeriousLate：严重迟到

     * Absenteeism：旷工迟到

     * NotSigned：未打卡
     * */
    @TableField(value = "time_result")
    private String timeResult;

    /**
     * 打卡人的UserID。
     * */
    @TableField(value = "user_id")
    private String userId;

    /** 打卡记录ID */
    @TableField(value = "record_id")
    private Long recordId;

    /**
     * 工作日
     * */
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @TableField(value = "work_date")
    private LocalDate workDate;

    /** 数据来源：

     ATM：考勤机打卡（指纹/人脸打卡）

     BEACON：IBeacon

     DING_ATM：钉钉考勤机（考勤机蓝牙打卡）

     USER：用户打卡

     BOSS：老板改签

     APPROVE：审批系统

     SYSTEM：考勤系统

     AUTO_CHECK：自动打卡
     */
    @TableField(value = "source_type")
    private String sourceType;

    /**
     * 实际打卡时间, 用户打卡时间的毫秒数。
     * */
    @TableField(value = "user_check_time")
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime userCheckTime;

    /** 排班ID */
    @TableField(value = "plan_id")
    private Long planId;



}